package com.chenjian.designpattern.factory;

/**
 * @author TC2952
 */
public class ComputerFactory {

    public static AbstractComputer createComputer(String type) {

        AbstractComputer abstractComputer = null;

        switch (type) {
            default:
                abstractComputer = new AbstractComputer() {
                    @Override
                    public void start() {
                        System.out.println("杂牌货");
                    }
                };
                break;
            case "lx":
                abstractComputer = new LxAbstractComputer();
                break;
            case "hp":
                abstractComputer = new HpAbstractComputer();
                break;
        }
        return abstractComputer;

    }
}
